<?php
/**
 * 电商交互控制器
 * User: lxq
 * Date: 2017/12/20
 * Time: 13:44
 */
class mutuallyControl extends Control{


    /**
     * 获取微信授权code
     */
    public function actionCallbackOp()
    {
        require_once(BASE_DATA_PATH.'/vendors/wechat/wesdk.php');
        $wesdk = new wesdk();
        $code = isset($_GET['code']) ? $_GET['code'] : false;
        if($code){
            $url = 'http://hucheng.myerm.cn/member/wechatcallback?code=' . $code . "&state=" . $_GET['state'];
            redirect($url);
        }else{
            $wesdk->OAuth(true);
        }


    }

    public function get_infoOp(){
        require_once(BASE_DATA_PATH.'/vendors/wechat/wesdk.php');
        $wesdk = new wesdk();
        $userInfo = $wesdk->OAuthUserInfo('061m1H390SZusI1XIZ090GbB390m1H3S');
        var_dump($userInfo);exit;
    }
}